package com.medical.admin.patient.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.medical.admin.patient.entity.MedicalRecord;

public interface MedicalRecordMapper extends BaseMapper<MedicalRecord> {
    default MedicalRecord selectByPatientId(Long patientId) {
        QueryWrapper<MedicalRecord> qw = new QueryWrapper<>();
        qw.lambda().eq(MedicalRecord::getPatientId, patientId);
        return this.selectOne(qw);
    }

    default int deleteByPatientId(Long patientId) {
        QueryWrapper<MedicalRecord> qw = new QueryWrapper<>();
        qw.lambda().eq(MedicalRecord::getPatientId, patientId);
        return this.delete(qw);

    }
}